﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ztn_iot_sdk_cSharp.bean;
using ztn_iot_sdk_cSharp.req;
using ztn_iot_sdk_cSharp.res;

namespace ztn_iot_sdk_cSharp.tool
{
    class IotDeviceSettingTool
    {

        private  const string BASE_PATH = "iot/api/v1/v1/device/setting/";


        public static List<DeviceSettingWithParamList> list(DeviceSettingListReq req)
        {
            string path = BASE_PATH + "list";
            BaseRes<List<DeviceSettingWithParamList>> res = HttpTool.doPost< BaseRes<List<DeviceSettingWithParamList>>>(path, JsonTool.toJson(req));
            if (null != res && null != res.data)
            {
                return res.data;
            }
            return new List<DeviceSettingWithParamList>();
        }

        public static DeviceSendRes send(DeviceSettingSendReq req)
        {
            string path = BASE_PATH + "send";
            BaseRes<DeviceSendRes> res = HttpTool.doPost<BaseRes<DeviceSendRes>>(path, JsonTool.toJson(req));
            if (null != res && null != res.data)
            {
                return res.data;
            }
            return null;
        }

    }
}
